import { uniFetch  } from '../utils/Ajax'
import {uniConfig} from '../config/index'
const appId = uniConfig.appId
const uniPost = uniFetch.uniPost
const basePath = uniConfig.prodPath + '/ucenter'
const wxAutoLoginMp = params => {
  return uniPost(
    {
      query: {
        appId: appId,
        autoNickname: 'Y',
        ...params
      }
    },
    basePath + '/openapi/openlogin/wxAutoLogin.xhtml'
  )
}

const bindWxUserInfo = params =>
  uniPost(
    {
      query: {
        ...params,
        appId: appId
      }
    },
    basePath + '/member/bindWxUserInfo.xhtml'
  )

const bindMobileByWx = params =>
  uniPost(
    {
      query: {
        appId: appId,
        ...params
      }
    },
    basePath + '/member/bindMobileByWx.xhtml'
  )

const loginWithMobileAndWxCode = params =>
  uniPost(
    {
      query: {
        appId: appId,
        ...params
      }
    },
    basePath + '/openapi/openlogin/loginWithMobileAndWxCode.xhtml'
  )

export {
  wxAutoLoginMp,
  bindMobileByWx,
  bindWxUserInfo,
  loginWithMobileAndWxCode
}
